module.exports = {

  /**
   * 格式化信息,返回必要的信息
   * @param list
   * @returns {Array}
   */
  formatGoodsInShopping: function (list) {
    var arr = [];
    for (var i in list) {
      var s = list[i];
      if (!s.good) {
        continue
      }
      arr.push({
        "good": {
          "thumb": s.good.thumb,
          "title": s.good.title,
          "rentPrice": {
            '1': s.good.rentPrice1 || 0,
            '2': s.good.rentPrice2 || 0,
            '3': s.good.rentPrice3 || 0,
            '4': s.good.rentPrice4 || 0,
          },
          "leftNum": s.good.leftNum,
          "thumbPath": s.good.thumbPath,
          "id": s.good.id
        },
        "createdAt": s.createdAt,
        "rentWeek": s.rentWeek,
        "id": s.id
      });
    }
    return arr;
  },

  formatAddressInUser: function (user) {
    return {
      recipient: user.recipient,
      phone: user.phone,
      city: user.city,
      district: user.district,
      ring: user.ring,
      address: user.address,
    }
  }
}
